<!doctype html>
<html lang="en">

<head>
    <title>Asgard Framework - {{.Subtitle}}</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta http-equiv="Content-Language" content="en" />
    <meta name="msapplication-TileColor" content="#206bc4" />
    <meta name="theme-color" content="#206bc4" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="HandheldFriendly" content="True" />
    <meta name="MobileOptimized" content="320" />
    <link rel="icon" href="/assets/image/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="/assets/image/favicon.ico" type="image/x-icon" />
    <link href="/assets/css/tabler.min.css" rel="stylesheet" />
    <link href="/assets/css/tabler-flags.min.css" rel="stylesheet" />
</head>

<body class="antialiased border-top-wide border-primary">
    <div class="d-flex h-auto min-h-full justify-content-center">
        <div class="d-flex align-items-center justify-content-center flex-fill">
            <div class="container">
                <div class="row">
                    <div class="col col-md-6 mx-auto">
                        <div class="text-center mb-4">
                            <img src="/assets/image/logo.svg" class="h-8" alt="">
                        </div>
                        <form id="register" class="card" method="post">
                            <div class="card-header">
                                <h3 class="card-title">创建账户</h3>
                            </div>
                            <div class="card-body">
                                <div class="mb-2">
                                    <label class="form-label">邮箱：</label>
                                    <input name="email" type="email" class="form-control" placeholder="请输入邮箱" required>
                                </div>
                                <div class="mb-2">
                                    <label class="form-label">手机号：</label>
                                    <input name="mobile" type="text" class="form-control" placeholder="请输入手机号" required>
                                </div>
                                <div class="mb-2">
                                    <label class="form-label">昵称：</label>
                                    <input name="nickname" type="text" class="form-control" placeholder="请输入昵称">
                                </div>
                                <div class="mb-2">
                                    <label class="form-label">密码：</label>
                                    <input name="password" type="password" class="form-control" placeholder="请输入密码"
                                        required>
                                </div>
                                <div class="mb-2">
                                    <label class="form-label">确认密码：</label>
                                    <input name="password-confirm" type="password" class="form-control"
                                        placeholder="请再次输入密码" required>
                                </div>
                            </div>
                            <div class="card-footer text-right">
                                <button type="submit" class="btn btn-primary col-md-4">创建账户</button>
                            </div>
                        </form>
                        <div class="text-center text-muted">
                            已经有账户? <a href="/login">登录</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<footer>
    <script type="text/javascript" src="/assets/js/bootstrap.bundle.min.js"></script>
    <script type="text/javascript" src="/assets/js/jquery.min.js"></script>
    <script type="text/javascript" src="/assets/js/tabler.min.js"></script>
    <script type="text/javascript" src="/assets/js/jquery.form.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#register").on("submit", function (event) {
                $('#register').ajaxSubmit({
                    url: "/register",
                    dataType: "json",
                    timeout: 60000,
                    success: function (data) {
                        if (data.code == 200) {
                            window.location.href = "/";
                        } else {
                            alert(data.message);
                        }
                    }
                })
                return false;
            });
        });
    </script>

</footer>

</html>